
package org.come.Jpanel;

import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.WorkshopRefiningBtn;
import com.tool.role.RoleData;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;

import java.awt.*;
import java.awt.image.ImageObserver;
import java.math.BigDecimal;
import java.util.Map;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

import org.come.bean.ConfigureBean;
import org.come.model.Configure;
import org.come.until.UserMessUntil;



public class WorkshopRefiningJpanel extends JPanel {
    private WorkshopRefiningCardJpanel cardJpanel;
    private WorkshopRefiningBtn btnEqui;
    private WorkshopRefiningBtn btnAcc;
    private WorkshopRefiningBtn btnRefiners;
    private WorkshopRefiningBtn btnSetsynthesis;
    private WorkshopRefiningBtn btnMenuGem;
    private WorkshopRefiningBtn btnGemRefinery;
    private ImageIcon icon;

    public WorkshopRefiningJpanel() {
        ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
        Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
        Configure configure = item.get(new BigDecimal(1));
        if ("水墨UI".equals(MyIsif.getStyle())) {
            this.setPreferredSize(new Dimension(558, 516));
            cardJpanel = new WorkshopRefiningCardJpanel();
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);

            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 61);
            offBtn.setBounds(558 - 36, 11, 25, 25);
            this.add(offBtn);

            // 炼化装备
            btnEqui = new WorkshopRefiningBtn("skin/8100226/newbutton/K30.png", 1, 1, cardJpanel, this);
            btnEqui.setBounds(53 + 0 * 97, 14, 95, 33);
            this.add(btnEqui);
            if (!"3".equals(configure.getLzjskg())) {
                // 炼化配饰
                btnAcc = new WorkshopRefiningBtn("skin/8100226/newbutton/K31.png", 1, 2, cardJpanel, this);
                btnAcc.setBounds(53 + 1 * 97, 14, 95, 33);
                this.add(btnAcc);
                // 炼器
                btnRefiners = new WorkshopRefiningBtn("skin/8100226/newbutton/K33.png", 1, 3, cardJpanel, this);
                btnRefiners.setBounds(53 + 2 * 97, 14, 95, 33);
                this.add(btnRefiners);
                // 套装合成
                btnSetsynthesis = new WorkshopRefiningBtn("skin/8100226/newbutton/K35.png", 1, 4, cardJpanel, this);
                btnSetsynthesis.setBounds(53 + 3 * 97, 14, 95, 33);
                this.add(btnSetsynthesis);
                if ("开".equals(configure.getBsqhkg())) {
                    // 宝石
                    btnGemRefinery = new WorkshopRefiningBtn("skin/8100226/newbutton/K47.png", 1, 5, cardJpanel, this);
                    btnGemRefinery.setBounds(53 + 4 * 97, 14, 95, 33);
                    this.add(btnGemRefinery);
                }
            }
            cardJpanel.setBounds(0, 0, 558, 516);
            this.add(cardJpanel);
        } else {
            this.setPreferredSize(new Dimension(536, 542));
            this.cardJpanel = new WorkshopRefiningCardJpanel();
            this.setLayout(null);
            this.setBackground(UIUtils.Color_BACK);
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/2/8_jpg.button.btn_close.jpg", 1, 61);
            offBtn.setBounds(510, 0, 23, 23);
            this.add(offBtn);
            this.btnEqui = new WorkshopRefiningBtn("inkImg/hongmu/2/refinEquipMenu.png", 1, 1, this);
            this.btnEqui.setBounds(30, 21, 93, 38);
            this.add(this.btnEqui);
            if (!"3".equals(configure.getLzjskg())) {
                this.btnAcc = new WorkshopRefiningBtn("inkImg/hongmu/2/unRefinAccMenu.png", 1, 2, this);
                this.btnAcc.setBounds(125, 21, 93, 38);
                this.add(this.btnAcc);
                this.btnRefiners = new WorkshopRefiningBtn("inkImg/hongmu/2/unRefinWareMenu.png", 1, 3, this);
                this.btnRefiners.setBounds(220, 21, 93, 38);
                this.add(this.btnRefiners);
                this.btnSetsynthesis = new WorkshopRefiningBtn("inkImg/hongmu/2/unSuitComMenu.png", 1, 4, this);
                this.btnSetsynthesis.setBounds(315, 21, 93, 38);
                this.add(this.btnSetsynthesis);
                if ("开".equals(configure.getBsqhkg())) {
                    this.btnMenuGem = new WorkshopRefiningBtn("inkImg/hongmu/2/unGemMenu.png", 1, 5, this);
                    this.btnMenuGem.setBounds(410, 21, 93, 38);
                    this.add(this.btnMenuGem);
                }
            }
            this.cardJpanel.setBounds(0, 0, 536, 542);
            this.add(this.cardJpanel);
        }
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        if ("水墨UI".equals(MyIsif.getStyle())) {
            if (icon == null) {
                icon = new ImageIcon("inkImg/newbackground/B241.png");
            }
            g.drawImage(icon.getImage(), 0, 0, 558, 516, this);
        } else {
            if (this.icon == null) {
                this.icon = new ImageIcon("inkImg/hongmu/2/workshop.png");
            }
            g.drawImage(this.icon.getImage(), 0, 0, 536, 542, null);
        }

    }

    public WorkshopRefiningCardJpanel getCardJpanel() {
        return this.cardJpanel;
    }

    public void setCardJpanel(WorkshopRefiningCardJpanel cardJpanel) {
        this.cardJpanel = cardJpanel;
    }

    public WorkshopRefiningBtn getBtnEqui() {
        return this.btnEqui;
    }

    public void setBtnEqui(WorkshopRefiningBtn btnEqui) {
        this.btnEqui = btnEqui;
    }

    public WorkshopRefiningBtn getBtnAcc() {
        return this.btnAcc;
    }

    public void setBtnAcc(WorkshopRefiningBtn btnAcc) {
        this.btnAcc = btnAcc;
    }

    public WorkshopRefiningBtn getBtnRefiners() {
        return this.btnRefiners;
    }

    public void setBtnRefiners(WorkshopRefiningBtn btnRefiners) {
        this.btnRefiners = btnRefiners;
    }

    public WorkshopRefiningBtn getBtnSetsynthesis() {
        return this.btnSetsynthesis;
    }

    public void setBtnSetsynthesis(WorkshopRefiningBtn btnSetsynthesis) {
        this.btnSetsynthesis = btnSetsynthesis;
    }

    public WorkshopRefiningBtn getBtnMenuGem() {
        return this.btnMenuGem;
    }

    public void setBtnMenuGem(WorkshopRefiningBtn btnMenuGem) {
        this.btnMenuGem = btnMenuGem;
    }

    public ImageIcon getIcon() {
        return this.icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public WorkshopRefiningBtn getBtnGemRefinery() {
        return btnGemRefinery;
    }

    public void setBtnGemRefinery(WorkshopRefiningBtn btnGemRefinery) {
        this.btnGemRefinery = btnGemRefinery;
    }

}
